﻿@model SaleSoft.Models.ScreenClient.WebMauScreenClient
@{
    ViewBag.Title = "Quản lý web mẫu";
    Layout = "~/Areas/administrator/Views/Shared/_Layout.cshtml";
}

<div class="bPageTitle">
    <div class="ptBody">
        <div class="content">
            <img src="/s.gif" alt="HoTroTrucTuyen" class="pageTitleIcon" title="HoTroTrucTuyen"><h1 class="pageType">
                Danh sách<span class="titleSeparatingColon">:</span></h1>
            <h2 class="pageDescription">
                Web mẫu</h2>
            <div class="blank">
                &nbsp;</div>
        </div>
    </div>
    <div class="ptBreadcrumb">
    </div>
</div>
<div class="hotListElement">
    <div class="bPageBlock secondaryPalette">
        <div class="pbHeader">
             <table border="0" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr>
                        <td class="pbTitle">
                            <img src="/s.gif" alt="" width="1" height="1" class="minWidth" title="">
                        </td>
                        <td class="pbButton">
                            @Html.ActionLink("Thêm mới", "Create", null, new
                       {
                           @class = "btn"
                       })
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="pbBody">
            <div class="pbSubheader first tertiaryPalette" id="head_1_ep">
                <h3>
                    Tìm kiếm<span class="titleSeparatingColon"></span></h3>
            </div>
            <div class="pbSubsection">
                @using (Html.BeginForm()) {
                    <table class="detailList" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="labelCol">
                                Tên
                            </td>
                            <td width="150px">
                                @Html.TextBoxFor(model => model.tenwebmau, new {
                               style = "width:400px"
                           })
                            </td>
                            <td class="labelCol">
                            </td>
                            <td width="150px">
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td class="labelCol">
                                Ngày cập nhật
                            </td>
                            <td colspan="4">
                                @(Html.Telerik().DatePickerFor(p => p.capnhattu)
                                    .Format("dd/MM/yyyy")
                                    .HtmlAttributes(new { @style = "width = 150px;"})
                                    .InputHtmlAttributes(new { @style = "width = 150px;" })
                                    .Max(DateTime.Now)
                                )&nbsp;- &nbsp;
                                @(Html.Telerik().DatePickerFor(p => p.capnhatden)
                                    .Format("dd/MM/yyyy")
                                    .HtmlAttributes(new { @style = "width = 150px;" })
                                    .InputHtmlAttributes(new { @style = "width = 150px;" })
                                    .Max(DateTime.Now)
                                )
                            </td>
                        </tr>
                        <tr>
                            <td class="labelCol">
                                Trạng thái
                            </td>
                            <td colspan="3">
                                 @(Html.Telerik().DropDownListFor(p => p.id_trangthai)
                                    .HtmlAttributes(new { @style = "width: 150px;"})
                                    .BindTo((SelectList)ViewBag.id_trangthai)
                                    .Placeholder("Tất cả")
                                 )
                            </td>
                            
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td class="labelCol">
                                Loại web
                            </td>
                            <td colspan="3">
                                @(Html.Telerik().DropDownListFor(p => p.id_loaiweb)
                                    .HtmlAttributes(new { @style = "width: 150px;"})
                                    .BindTo((SelectList)ViewBag.id_loaiweb)
                                    .Placeholder("Tất cả")
                                 )
                            </td>
                            
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td class="labelCol">
                                
                            </td>
                            <td colspan="4">
                                @(Html.Telerik().CurrencyTextBoxFor(p => p.giatu)
                                    .CurrencySymbol("VND")
                                    .HtmlAttributes(new { @style = "width = 100px;"})
                                    .MinValue(0)
                                    .EmptyMessage("Giá từ")
                                )&nbsp;-&nbsp;
                                @(Html.Telerik().CurrencyTextBoxFor(p => p.giaden)
                                    .CurrencySymbol("VND")
                                    .HtmlAttributes(new { @style = "width = 100px;"})
                                    .MinValue(0)
                                    .EmptyMessage("đến")
                                )
                            </td>
                        </tr>
                        
                        <tr style="height: 50px">
                            <td>
                            </td>
                            <td colspan="3" style="padding: 15px 15px 15px 15px">
                                <input type="submit" class="btn" style="width: 100px" name="btnSave" value="Tìm..." />
                            </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                    <table class="detailList" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                @(Html.Telerik().Grid(Model.DSWebMau)
                                .Name("grdAdmnGroup")
                                .DataKeys(k => k.Add(c => c.id_loaiweb))
                                .Sortable()
                                .Selectable(selecting => selecting.Enabled(true))
                                .DataBinding(databinding =>
                                {
                                    databinding.Server()
                                        .Select("Index", "WebMau");
                                    databinding.Ajax()
                                        .Select("_Index", "WebMau");
                                })
                                .Editable(editing => editing.Mode(GridEditMode.InLine))
                                 .Columns(col =>
                                 {
                                     col.Bound(o => o.TenLoaiWeb)
                                         .Title("Loại web")
                                         .Width(80);
                                     col.Bound(o => o.urlhinh)
                                         .Title("Hình ảnh")
                                          .Template(@<text>
                                            <img title="@item.tenwebmau" alt="@item.tenwebmau" src="@Href("~/UploadImages/")@item.urlhinh" width="100"/>
                                         </text>)
                                        .ClientTemplate("<img title='<#= tenwebmau #>' alt='<#= tenwebmau #>' src='" + @Href("~/UploadImages/") + "<#= urlhinh #>' width='100'/>")
                                         .Width(100);
                                     col.Bound(o => o.TenAlbum)
                                         .Template(@<text>
                                            <img title="@item.TenAlbum" alt="@item.TenAlbum" src="@Href("~/UploadImages/")@item.HinhAlbum" width="100"/>
                                         </text>)
                                        .ClientTemplate("<img title='@item.TenAlbum' alt='@item.TenAlbum' src='" + @Href("~/UploadImages/") + "<#= HinhAlbum #>' width='100'/>")
                                         .Title("Album")
                                         .Width(100);
                                     col.Bound(o => o.tenwebmau)
                                         .Title("Tên web mẫu")
                                         .Width(150);
                                     
                                     col.Bound(o => o.gia)
                                         .Title("Giá")
                                         .Format("VND {0:#,##0}")
                                         .Width(100);
                                     col.Bound(o => o.TenTrangThai)
                                         .Title("Trạng thái")
                                         .Width(80);
                                     col.Template(@<div style="text-align:center;">
                                        <a href="/administrator/WebMau/Edit/@item.id_webmau" title="Edit">
                                            <img src="@Href("~/Content/images/icons/pencil.png")" alt="Edit" /></a>
                                        <a href="/administrator/WebMau/Delete/@item.id_webmau" title="Delete" onclick="return confirm('Do you want to delete these data?');">
                                            <img src="@Href("~/Content/images/icons/cross.png")" alt="Delete" /></a></div>)
                                        .ClientTemplate("<div style='text-align:center;'>" +
                                        "<a href='/administrator/WebMau/Edit/<#= id_webmau #>' title='Edit'>" +
                                            "<img src='" + @Href("~/Content/images/icons/pencil.png") + "' alt='Edit' /></a>" +
                                            "<a href='/administrator/WebMau/Delete/<#= id_webmau #>' title='Delete' onclick='return confirm('Do you want to delete these data?');'>" +
                                            "<img src='" + @Href("~/Content/images/icons/cross.png") + "' alt='Delete' /></a></div>")
                                        .Width(80);
                         })
                            .Pageable(paging => paging.Enabled(true).PageSize(20).Style(GridPagerStyles.NextPreviousAndInput))
                            .Resizable(r => r.Columns(true))
                            .Filterable()
                            .Reorderable(r => r.Columns(true))
                            .Groupable(grouping => grouping.Groups(groups => 
                                {
                                    groups.Add(c => c.TenLoaiWeb);
                                }) )
                                                                )
                            </td>
                        </tr>
                    </table>
                }
            </div>
            <div class="pbFooter secondaryPalette">
                <div class="bg">
                </div>
            </div>
        </div>
    </div>
</div>

